package com.itheima.app.exception;

import com.itheima.vo.ErrorResult;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
//统一异常处理器
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler
    public ResponseEntity globalHandler(Exception ex){
        ex.printStackTrace();
        //通知开发人员和运维人员
        return ResponseEntity.status(500).body(ErrorResult.error());
    }
}
